﻿using Microsoft.EntityFrameworkCore;
using MyEartags.EarTag;
using MyEartags.Hint;
using MyEartags.Individual;
using MyEartags.PairVariety;
using MyEartags.SheepTag;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.EntityFrameworkCore;

namespace FinalItem.MyEartags
{
    public class MyEartagsMigrationsDbContext : AbpDbContext<MyEartagsMigrationsDbContext>
    {
        public MyEartagsMigrationsDbContext(DbContextOptions<MyEartagsMigrationsDbContext> options) : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            //modelBuilder.ConfigureMyModule();

            modelBuilder.Entity<Varieties>(b =>
            {
                b.ToTable("Varieties");
                //b.ConfigureByConvention();
                b.Property(v => v.VarietiesName).IsRequired().HasMaxLength(100);
            });

            modelBuilder.Entity<Earoverbit>(b =>
            {
                b.ToTable("Earoverbit");
                //b.ConfigureByConvention();
                b.Property(v => v.OverbitName).IsRequired().HasMaxLength(100);
            });

            modelBuilder.Entity<SheepLabel>(b =>
            {
                b.ToTable("SheepLabel");
                //b.ConfigureByConvention();
                b.Property(v => v.ElectronicEar).IsRequired().HasMaxLength(100);
            });

            modelBuilder.Entity<Allocation>(b =>
            {
                b.ToTable("Allocation");
                //b.ConfigureByConvention();
                b.Property(v => v.BreedingOverbit).IsRequired().HasMaxLength(100);
            });

            modelBuilder.Entity<Gestation>(b =>
            {
                b.ToTable("Gestation");
                //b.ConfigureByConvention();
                b.Property(v => v.BreedingOverbit).IsRequired().HasMaxLength(100);
            });

            modelBuilder.Entity<Delivery>(b =>
            {
                b.ToTable("Delivery");
                //b.ConfigureByConvention();
                b.Property(v => v.BreedingOverbit).IsRequired().HasMaxLength(100);
            });

            modelBuilder.Entity<ZooidBuy>(b =>
            {
                b.ToTable("ZooidBuy");
                //b.ConfigureByConvention();
                b.Property(v => v.Document).IsRequired().HasMaxLength(100);
            });

            modelBuilder.Entity<ZooidSelling>(b =>
            {
                b.ToTable("ZooidSelling");
                //b.ConfigureByConvention();
                b.Property(v => v.Document).IsRequired().HasMaxLength(100);
            });
        }
    }
}

